ComponentOne FlexChart for WinForms
Showing or Hiding a Series
FlexChart > Working with FlexChart > Data > Plotting Data > Customizing Series > Showing or Hiding a Series

If there are hundreds of series to be displayed in your chart, you would certainly need to manage the same due to the space limitation of the chart.

In FlexChart, you can manage series by using the Visibility property of a series. The Visibility property accepts values of the SeriesVisibility enumerated type.

You can set the property to the following different values to show or hide a series:

Value Description
SeriesVisibility.Visible The series is displayed in the Plot as well as the Legend.
SeriesVisibility.Plot The series is displayed in the Plot, but hidden in the Legend.
SeriesVisibility.Legend The series is displayed in the Legend, but hidden in the Plot.
SeriesVisibility.Hidden The series is hidden in the Plot as well as the Legend.

Let's use the same scenario used in the Bar Chart. Refer to Bar Chart to see the complete scenario.

In the same scenario, suppose that you want to display comparison between products in terms of only unit price and units in stock. 

To do the same, you can very well use the Visibility property.

Here's the code snippet for reference:

' name the series
series1.Name = "Unit Price"
series2.Name = "Units In Stock"
series3.Name = "Units On Order"

' to hide Units On Order
series3.Visibility = C1.Chart.SeriesVisibility.Hidden
// name the series
series1.Name = "Unit Price";
series2.Name = "Units In Stock";
series3.Name = "Units On Order";

// to hide Units On Order
series3.Visibility = C1.Chart.SeriesVisibility.Hidden;

If you want to show the series (Units On Order) in the Plot Area, but at the same not display it in the Legend, you can use the Visibility property in the following manner:

' name the series
series1.Name = "Unit Price"
series2.Name = "Units In Stock"
series3.Name = "Units On Order"

' to show Units On Order in the Plot but not in the Legend
series3.Visibility = C1.Chart.SeriesVisibility.Plot
// name the series
series1.Name = "Unit Price";
series2.Name = "Units In Stock";
series3.Name = "Units On Order";

// to show Units On Order in the Plot but not in the Legend
series3.Visibility = C1.Chart.SeriesVisibility.Plot;

 

Similarly, for displaying the series in the Legend, but not in the Plot Area, you can set the Visibility property as follows:

' name the series
series1.Name = "Unit Price"
series2.Name = "Units In Stock"
series3.Name = "Units On Order"

' to show Units On Order in the Legend but not in the Plot
series3.Visibility = C1.Chart.SeriesVisibility.Legend
// name the series
series1.Name = "Unit Price";
series2.Name = "Units In Stock";
series3.Name = "Units On Order";

// to show Units On Order in the Legend but not in the Plot
series3.Visibility = C1.Chart.SeriesVisibility.Legend;